home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 37 / CD Expert nº 37.iso / LastCall / lastcall.exe / stuff / lastcall.dxr / 00001_Bottle Behavior.ls next >
Encoding:
Text File  |  2000-03-27  |  3.4 KB  |  144 lines

  1. property pOrigMember, pMouseLoc, pSpr, pTilt, pTimer, pIngredient, pLiquidColor, pXbottle, pOrigIngredient, pPickItUp
  2. global gFloatSprite
  3.  
  4. on beginSprite me
  5.   pSpr = sprite(me.spriteNum)
  6.   pOrigMember = pSpr.member
  7.   pOrigIngredient = pIngredient
  8.   mUseOrigBottle(me)
  9. end
  10.  
  11. on mUseOrigBottle me
  12.   pSpr.member = pOrigMember
  13.   pIngredient = pOrigIngredient
  14.   pLiquidColor = getLiquidColor(pIngredient)
  15.   pXbottle = 0
  16. end
  17.  
  18. on mUseXbottle me, xIngredient
  19.   global gXbottleAlerts
  20.   if xIngredient = pOrigIngredient then
  21.     mUseOrigBottle(me)
  22.   else
  23.     pSpr.member = member("xbottle")
  24.     pIngredient = xIngredient
  25.     pLiquidColor = getLiquidColor(pIngredient)
  26.     pXbottle = 1
  27.     updateStage()
  28.     if gXbottleAlerts[xIngredient] = 1 then
  29.       gXbottleAlerts[xIngredient] = 2
  30.     end if
  31.   end if
  32.   mPickMeUp(me)
  33. end
  34.  
  35. on getPropertyDescriptionList me
  36.   liquorList = [#sweetVermouth, #BITTERS, #dryVermouth, #milk, #SUGAR, #scotch, #bourbon, #whiskey, #kahfee, #tripleSec, #cocoRum, #melonLiquer, #raspberry, #grenadine, #lime, #vodka, #GIN, #rum, #tequila, #amaretto, #orange, #cranberry, #grapefruit, #pineapple, #lemon]
  37.   myList = [#pIngredient: [#default: #vodka, #format: #symbol, #comment: "Ingredient:", #range: liquorList], #pTilt: [#default: #left, #comment: "Tilt", #format: #symbol, #range: [#left, #right]]]
  38.   return myList
  39. end
  40.  
  41. on mReplaceIt me
  42.   pPickItUp = 0
  43.   if pXbottle and not modifierDown() then
  44.     mUseOrigBottle()
  45.   end if
  46.   pSpr.visible = 1
  47. end
  48.  
  49. on rightMouseDown me
  50.   global gXbottlePopup
  51.   if the stage = the activeWindow then
  52.     pMouseLoc = the clickLoc
  53.     sendSprite(gXbottlePopup, #mShowPopup, pSpr, pOrigIngredient)
  54.   end if
  55. end
  56.  
  57. on mouseDown me
  58.   global gXbottlePopup
  59.   pPickItUp = 1
  60.   if the doubleClick then
  61.     exit
  62.   end if
  63.   if draggingAnything() then
  64.     replaceDraggingAnything()
  65.   else
  66.     if modifierDown() then
  67.       pMouseLoc = the clickLoc
  68.       sendSprite(gXbottlePopup, #mShowPopup, pSpr, pOrigIngredient)
  69.       exit
  70.     end if
  71.     menuDown = nowTicks()
  72.     repeat while the stillDown
  73.       updateStage()
  74.       checkElapsedTime()
  75.       if ticksSince(menuDown) > 60 then
  76.         pMouseLoc = the clickLoc
  77.         sendSprite(gXbottlePopup, #mShowPopup, pSpr, pOrigIngredient, pMouseLoc)
  78.         exit
  79.         next repeat
  80.       end if
  81.       if ticksSince(menuDown) > 10 then
  82.         forceToolTip(pSpr, pIngredient, the clickLoc)
  83.       end if
  84.     end repeat
  85.     mPickMeUp(me, 1)
  86.   end if
  87. end
  88.  
  89. on mPickMeUp me, noToolTip, pickupLoc
  90.   global gFloatSprite
  91.   replaceDraggingAnything()
  92.   pPickItUp = 0
  93.   if voidp(pickupLoc) then
  94.     if the mouseV < pSpr.locV then
  95.       pickupLoc = the mouseLoc
  96.     else
  97.       pickupLoc = pSpr.loc
  98.     end if
  99.   end if
  100.   sendSprite(gFloatSprite, #mPickUpBottle, pSpr, 0, pLiquidColor, pIngredient, mGetPourSound(me), VOID, pickupLoc)
  101.   if not noToolTip then
  102.     forceToolTip(pSpr, pIngredient, point(pSpr.left, pSpr.top + (pSpr.height / 3)))
  103.   end if
  104. end
  105.  
  106. on mouseUp me
  107.   global gQuickPlayMode
  108.   if pPickItUp and gQuickPlayMode then
  109.     mPickMeUp(me, 1)
  110.   end if
  111. end
  112.  
  113. on mGetPourSound me
  114.   if pIngredient = #SUGAR then
  115.     return "sugar_sound"
  116.   else
  117.     return VOID
  118.   end if
  119. end
  120.  
  121. on mouseEnter me
  122.   if not draggingAnything() then
  123.     pTimer = nowTicks()
  124.     showToolTip(pSpr, pIngredient)
  125.   end if
  126. end
  127.  
  128. on mouseWithin
  129.   if draggingAnything() then
  130.   else
  131.     if tipTickRange(pTimer) then
  132.       forceToolTip(pSpr, pIngredient)
  133.     else
  134.       dismissToolTip()
  135.     end if
  136.   end if
  137. end
  138.  
  139. on mouseLeave me
  140.   if not draggingAnything() then
  141.     hideToolTip()
  142.   end if
  143. end
  144.